// 创建base64file
export function createBase64 (file) {
  return new Promise((resolve, reject) => {
    // Make new FileReader
    const reader = new FileReader()

    // Convert the file to base64 text
    reader.readAsDataURL(file)

    // on reader load somthing...
    reader.onload = function (e) {
      resolve(e.target.result)
    }

    reader.onerror = function () {
      reject(new Error())
    }
  })
}
